package com.sinodoggo.shitcloud.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sinodoggo.shitcloud.entity.RoleMenu;
import com.sinodoggo.shitcloud.mapper.RoleMenuMapper;
import com.sinodoggo.shitcloud.service.IRoleMenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author sinodoggo
 * @since 2022-11-22
 */
@Service
public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements IRoleMenuService {
    @Resource
    private RoleMenuMapper mapper;

    @Override
    public boolean removeBatchByRoleId(Integer roleId) {
        QueryWrapper<RoleMenu> wrapper = new QueryWrapper<>();
        wrapper.eq("role_id", roleId);
        final int affectRows = mapper.delete(wrapper);
        return affectRows >= 0;
    }
}
